﻿@using QDT.Common
@using QDT.Core.Domain.Enums
@using QDT.Web.Admin.Models
@model QDT.Web.Admin.Models.ArticleCateModel

<div class="main_title">新增 
    @Html.ActionLink("返回列表","Index","ArticleCate",new{@class="back_list"})
    </div>
<div class="blank5"></div>
@using(Html.BeginForm("PostEdit","ArticleCate",FormMethod.Post)) {
<table class="form" cellpadding="0" cellspacing="0">
	<tbody><tr>
		<td colspan="2" class="topTd"></td>
	</tr>
	<tr>
		<td class="item_title">分类名称:</td>
        <td class="item_input">
            <input type="text" class="textbox require" name="Title" value="@Model.Title">
        </td>
	</tr>
	<tr>
		<td class="item_title">简单描述:</td>
		<td class="item_input"><textarea class="textarea" name="Brief">@Model.Brief</textarea></td>
	</tr>
	<tr>
		<td class="item_title">分类:</td>
		<td class="item_input">
		<select name="ParentId">
            <option value="0">==顶级分类==</option>
            @if (ViewData["CateModel"] != null) {
                foreach (var m in ViewData["CateModel"] as IList<ArticleCateTree>)
                {
                    if (m.Id == Model.ParentId) {
                        <option value="@m.Id" selected="selected">@(new MvcHtmlString(m.Title))</option>
                        continue;
                    }
                    <option value="@m.Id">@(new MvcHtmlString(m.Title))</option>

                }
            }
            
			</select>
		</td>
	</tr>
	<tr id="article_type" style="">
		<td class="item_title">文章类型:</td>
        <td class="item_input">
           <select name="TypeId">
            @foreach (ArticleType item in Enum.GetValues(typeof(ArticleType)))
            {@(Model.TypeId==(int)ArticleType.Media)
                 <option value="@((int)item)" selected="@(Model.TypeId == (int)item? "selected":"")">@item.ToLocalizable()</option>
            }
            </select>
        </td>
	</tr>
	<tr>
		<td class="item_title">排序:</td>
		<td class="item_input"><input type="text" class="textbox" name="sort" value="@Model.Sort"></td>
	</tr>
	<tr>
		<td class="item_title">状态:</td>
		<td class="item_input">
			<lable>有效<input type="radio" name="IsEffect" value="true" @(Model.IsEffect ? "checked" : "")></lable>
			<lable>无效<input type="radio" name="IsEffect" value="false"  @(!Model.IsEffect ? "checked" : "")></lable>
		</td>
	</tr>
	<tr>
		<td class="item_title"></td>
		<td class="item_input">
            <!--隐藏元素-->
            <input type="hidden" value="@Model.Id" name ="Id"/>
			<!--隐藏元素-->
			<input type="submit" class="button" value="编辑">
			<input type="reset" class="button" value="重置">
		</td>
	</tr>
	<tr>
		<td colspan="2" class="bottomTd"></td>
	</tr>
</tbody></table>	 
}